home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 24 / AACD 24.iso / AACD / Programming / exif.lib / dev / examples / read / main.c next >
C/C++ Source or Header  |  2001-01-03  |  1KB  |  74 lines

  1. /*    This example use of exif.library reads and displays any exif
  2.         information contained in a jfif file.
  3. */
  4.  
  5. #include <stdio.h>
  6.  
  7. #include <exec/types.h>
  8.  
  9. #include <clib/exec_protos.h>
  10.  
  11. #include <pragmas/exec_pragmas.h>
  12.  
  13. #include <exif/exif.h>
  14. #include <exif/exif_protos.h>
  15. #include <exif/exif_pragmas.h>
  16.  
  17. struct Library *ExifBase;
  18.  
  19. char *version = "$VER: read 1.0 (3.1.2001)";
  20.  
  21. void main( int argc, char **argv )
  22. {
  23.     if ( argv[1] )
  24.     {
  25.         ExifBase = OpenLibrary( "exif.library", 1 );
  26.  
  27.         if ( ExifBase != NULL )
  28.         {
  29.             struct Exif *exif;
  30.  
  31.             exif = ReadExif( argv[1], NULL );
  32.             if ( exif )
  33.             {
  34.                 struct MinNode *work1, *next1, *work2, *next2;
  35.  
  36.                 printf( "Exif length=%ld\n", exif->ExifLength );
  37.                 printf( "Thumbnail size=%ld\n", exif->ThumbnailSize );
  38.  
  39.                 work1 = exif->ExifTagList.mlh_Head;
  40.  
  41.                 while ( next1 = work1->mln_Succ )
  42.                 {
  43.                     printf( "DIR NAME: %s\n",( (struct ExifTagDir *)work1 )->etd_ID );
  44.  
  45.                     work2 = ( (struct ExifTagDir *)work1 )->etd_Dir.mlh_Head;
  46.  
  47.                     while ( next2 = work2->mln_Succ )
  48.                     {
  49.                         char *data = (char *)( (struct ExifTag *)work2 )->et_StringEquiv;
  50.  
  51.                         if ( data[0] != NULL )
  52.                         {
  53.                             printf("\t%s=%s\n", (char *)( (struct ExifTag *)work2 )->et_TagDescription, data );
  54.                         }
  55.  
  56.                         work2 = next2;
  57.                     }
  58.  
  59.                     work1 = next1;
  60.                 }
  61.  
  62.                 FreeExif( exif );
  63.             }
  64.         }
  65.  
  66.         if ( ExifBase != NULL ) CloseLibrary( ExifBase );
  67.         else printf( "you need exif.library v1.0 minimum\n" );
  68.     }
  69.     else
  70.     {
  71.         printf( "no source file specified\n" );
  72.     }
  73. }
  74.